<?php

namespace api\portal\controller;

use cmf\controller\RestBaseController;
use api\portal\model\PortalCategoryModel;

use think\Db;

class GonggaoController extends RestBaseController
{
    protected $categoryModel;

    public function list() {
      if (empty($this->user)) {
        unauthorized();
      }

      return Db::name('gonggao')->orderRaw('id desc')->select();
    }

    public function single() {
      $param = $this->request->param();
      if (isset($param['id']) || intval($param['id']) > 0) {
        $data = Db::name('gonggao')->where('id', $param['id'])->orderRaw('id desc')->find();
        $this->success('获取成功', $data);
      } else {
        $this->error('参数不正确');
      }
    }

}
